<!DOCTYPE html>
<html>

{include file='public/header'}

<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="javascript:void(0)">首页</a>
            <a href="javascript:void(0)">平台管理</a>
            <a><cite>微信服务商平台管理</cite></a>
        </span>
        <a class="layui-btn layui-btn-small" id="reload" title="刷新">
            <i class="layui-icon" style="line-height:30px"><i class="iconfont">&#xe6aa;</i></i>
        </a>
    </div>
    <div class="x-body">
        <table id="admin" lay-filter="admin"></table>
    </div>
    <script type="text/html" id="toolbarDemo">
        <div class="layui-btn-container">
            <button class="layui-btn layui-btn-sm" lay-event="add">添加</button>
        </div>
    </script>
    <script type="text/html" id="download_atNumTpl">
    <a class="layui-btn layui-btn-primary layui-btn-xs layui-table-link" lay-event="look_a">{{
        d.download_at? dayjsFormat(d.download_at):'' }}{{d.downloadname}}</a>
</script>
<script type="text/html" id="tbBar">
        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>

    </script>
    <script>
        let params = {
            elem: '#admin'
            , toolbar: '#toolbarDemo'
            , url: '/admin/partner/list' //数据接口
            , id: 'admin'
            ,page:true
            , cols: [[ //表头
                { field: 'id', title: 'ID',align:'center', width: 80 }
                , { field: 'type_name',width:200, title: '类型' }
                , { field: 'name',width:200, title: '名称' }
                , { field: 'app_id', title: 'app_id' }
                , { toolbar: '#tbBar', title: '操作', width: 150 }
            ]],
        }
        tableList(params)

        layui.use('table', function () {
            var table = layui.table;
            table.on('toolbar(admin)', function (obj) {
                var event = obj.event;
                if (event === 'add') {
                    x_admin_show('添加管理员', './info.html', 650, 500);
                }
            });
            table.on('tool(admin)', function (obj) {
                var event = obj.event;
                if (event === 'del') {
                    tableAjax('/admin/partner/delete',{ id: obj.data.id },'admin')
                } else if (event === 'edit') {
                    x_admin_show('编辑管理员', `./info.html?id=${obj.data.id}`, 650, 500);
                }
            });
        });
    </script>
</body>

</html>